#define _CRT_SECURE_NO_WARNINGS 1

class Solution {
public:

    void algorithm(vector<int>& x, vector<int>& y, vector<int>& z, int n)
    {
        if (n == 1)
        {
            z.push_back(x.back());
            x.pop_back();
            return;
        }
        algorithm(x, z, y, n - 1);
        z.push_back(x.back());
        x.pop_back();
        algorithm(y, x, z, n - 1);



    }

    void hanota(vector<int>& A, vector<int>& B, vector<int>& C)
    {
        algorithm(A, B, C, A.size());
        return;
    }
};